home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacFormat España 20
/
macformat_20.iso
/
mac
/
Shareware
/
Desarrolladores
/
Sprite Animation Toolkit 2.3.8
/
Add-ons
/
Load faces
/
FaceFromPICT.p
< prev
next >
Wrap
Text File
|
1996-01-08
|
1KB
|
62 lines
unit FaceFromPICT;
interface
uses
{$IFC UNDEFINED THINK_PASCAL}
Types, QuickDraw, Memory, Resources, ToolUtils,
{$ENDC}
SAT;
function GetFaceFromPICT (colorPICTid, bwPICTid, maskPICTid: integer): FacePtr;
implementation
{No error checking yet!}
function GetFaceFromPICT (colorPICTid, bwPICTid, maskPICTid: integer): FacePtr;
var
bounds: Rect;
thePICT, maskPICT: PicHandle;
theFace: FacePtr;
savePort: SATPort;
begin
SATGetPort(savePort);
{Get PICTs}
{IDEA: It should really check if the PICT it loads was loaded already, and if it was, don't dispose it.}
if gSAT.initDepth > 1 then
thePICT := GetPicture(colorPICTid)
else
thePICT := GetPicture(bwPICTid);
maskPICT := GetPicture(maskPICTid);
if (thePICT = nil) or (maskPICT = nil) then
begin
GetFaceFromPICT := nil;
exit(GetFaceFromPICT);
end;
bounds := thePICT^^.picFrame;
OffsetRect(bounds, -bounds.left, -bounds.top);
{Create face}
theFace := SATNewFace(bounds);
{Draw in the face}
SATSetPortFace(theFace);
DrawPicture(thePICT, bounds);
SATSetPortMask(theFace);
DrawPicture(maskPICT, bounds);
{Tell SAT that we are done}
SATChangedFace(theFace);
{Get rid of the PICTs}
ReleaseResource(Handle(thePICT));
ReleaseResource(Handle(maskPICT));
{Return the face.}
GetFaceFromPICT := theFace;
SATSetPort(savePort);
end;
end.